import React, { Component } from 'react'
import Header from '../../components/Header'
import { connect } from 'react-redux'
import { Button } from 'antd-mobile'
class Index extends Component {
  render() {
    return (
      <div className='box'>
        <Header title='用户' />
      <div className='content'>

        {this.props.loginState ?
        (<Button onClick={()=>{
          this.props.logout()
        }}>退出登录</Button>)
        :
        (<Button >去登录</Button>)}

      </div>
    </div>
    )
  }
}

export default connect((state)=>{
  return {
    loginState: state.getIn(['user', 'loginState'])
  }
},(dispatch)=>{
  return {
    logout(){
      // 1. 清除全局状态中的数据
      // 2. 清除本地存储的数据
    }
  }
})(Index)
